package reflect;

import java.lang.reflect.Method;
import java.util.Scanner;

public class ReflectDemo2 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入类名：");
        String className = scanner.nextLine();

        try {
            Class cls = Class.forName(className);//classname要是完全限定名
            Method[] methods = cls.getMethods();
            for(Method m : methods){
                System.out.println("方法名：" + m.getName());
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
